package com.zhou.juc.test01_thread;

import java.util.concurrent.TimeUnit;

/**
 * @author zhouyanxiang
 * @create 2020-06-2020/6/15-19:45
 */
public class T01_WhatIsThread {
    private static  class FirstThread extends Thread{
        @Override
        public void run(){
            for (int i = 0; i < 1000; i++) {
                try {
                    TimeUnit.MICROSECONDS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }finally {
                    System.out.println("this is the first thread");
                }
            }
        }
    }

    public static void main(String[] args) {
        FirstThread firstThread = new FirstThread();
        firstThread.start();
        for (int i = 0; i < 1000; i++) {
            try {
                TimeUnit.MICROSECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }finally {
                System.out.println("this is main thread");
            }
        }
    }
}
